Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of stress calculations #978

Merged
merged 28 commits into from
Jun 5, 2024

Conversation

mfherbst
Copy link
Member

@mfherbst mfherbst commented May 25, 2024

Closes #893

I made a pass though the stress routines:

  • Only compute 6 instead of 9 components
  • Avoid generic FFTs when building the density
  • Be more careful when caching projectors (caching should in general ignore the dual tag and just care about the value of the G vector norm)
  • Use explicit derivative formula in custom rule to avoid duals in integration routines, such that loop vectorisation can play its tricks
  • Introduce energy-only function, which avoids building the Hamiltonian object (and allocating its cache for matrix-vector products)

Saves a factor of 3 in runtime for the stresses on of my tests and drastically reduces allocations (about a 5th).

src/common/hankel.jl Outdated Show resolved Hide resolved
src/common/hankel.jl Outdated Show resolved Hide resolved
src/density_methods.jl Outdated Show resolved Hide resolved
src/postprocess/stresses.jl Show resolved Hide resolved
src/terms/Hamiltonian.jl Show resolved Hide resolved
@mfherbst mfherbst force-pushed the fix_stress_performance_issues branch from eadb9f3 to b57b371 Compare June 4, 2024 08:05
@mfherbst mfherbst force-pushed the fix_stress_performance_issues branch from 5a3a909 to f3fbee9 Compare June 4, 2024 10:31
src/common/quadrature.jl Outdated Show resolved Hide resolved
src/common/hankel.jl Show resolved Hide resolved
src/common/quadrature.jl Outdated Show resolved Hide resolved
src/postprocess/stresses.jl Outdated Show resolved Hide resolved
@mfherbst mfherbst merged commit f49a97c into master Jun 5, 2024
5 of 7 checks passed
@mfherbst mfherbst deleted the fix_stress_performance_issues branch June 5, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stresses need an unreasonable amount of memory and runtime
2 participants